package cn.edu.dgut.experiment2.config;

import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
import org.springframework.boot.autoconfigure.task.TaskExecutionAutoConfiguration;
import org.springframework.boot.autoconfigure.task.TaskExecutionProperties;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.context.annotation.Bean;
import org.springframework.core.env.Environment;
import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor;

/** 实验二  利用Spring boot的自动装配特性实现动态注册组件
 *
 *   create by Yang on 2020.4.11
 */

@EnableConfigurationProperties(CustomProperties.class)
public class Lab2AutoConfig {

    @Bean
    @ConditionalOnProperty(prefix = "experiment2.auto", name = "enable", havingValue = "true")
    public CustomCommandlineRunner customCommandlineRunner(Environment env) {
        return new CustomCommandlineRunner(env);
    }
}
